package com.hc.other;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class BusDriverProxy implements InvocationHandler {
    Driver driver;

    public BusDriverProxy(Driver driver) {
        this.driver = driver;
    }

    public void check(){
        System.out.println("bus driver proxy is checking bus status");
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        check();
        Object object = method.invoke(driver, args);
        return object;
    }
}
